package com.example.mapp;

import com.example.entity.authority.PartyCheck;
import com.example.mapp.buildSql.PartyCheckMappSql;
import com.example.mapp.buildSql.SysUserMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by youkun on 2018/3/16.
 * 机构审核表
 */
@Mapper
public interface PartyCheckMapp {

    @Insert("insert into party_check (" +
            "party_Name,party_province,party_city,party_area,party_Addr," +
            "corporation,telephone,postal_Code,credit_Code,industry,contacts," +
            "contacts_Work,contacts_Card,contacts_Phone,contacts_Emile,contacts_Mobile," +
            "contacts_Address,business_License_Img,start_Time," +
            "success_Time,status,remarks,user_code,password,party_type,business_License_Num," +
            "zzzs,zzdj,maint_start"+
            ") values (" +
            "#{partyName},#{partyProvince},#{partyCity},#{partyArea},#{partyAddr}," +
            "#{corporation},#{telephone},#{postalCode},#{creditCode},#{industry},#{contacts}," +
            "#{contactsWork},#{contactsCard},#{contactsPhone},#{contactsEmile},#{contactsMobile}," +
            "#{contactsAddress},#{businessLicenseImg},#{startTime}," +
            "#{successTime},#{status},#{remarks},#{userCode},#{password},#{partyType},#{businessLicenseNum}" +
            ",#{zzzs},#{zzdj},#{maintStart}"+
            ") ")
    int insert(PartyCheck partyCheck)throws Exception;

    @Update("update party_check set " +
            "party_Name=#{partyName},party_province=#{partyProvince},party_city=#{partyCity}" +
            ",party_area=#{partyArea},party_Addr=#{partyAddr}," +
            "corporation=#{corporation},telephone=#{telephone},postal_Code=#{postalCode},credit_Code=#{creditCode},industry=#{industry}" +
            ",contacts=#{contacts},zzzs=#{zzzs},zzdj=#{zzdj}," +
            "contacts_Work=#{contactsWork},contacts_Card=#{contactsCard},contacts_Phone=#{contactsPhone}," +
            "contacts_Emile=#{contactsEmile},contacts_Mobile=#{contactsMobile}," +
            "contacts_Address=#{contactsAddress},business_License_Img=#{businessLicenseImg},start_Time=#{startTime}," +
            "success_Time=#{successTime},status=#{status},remarks=#{remarks},user_code=#{userCode}," +
            "password=#{password},party_type=#{partyType},business_License_Num=#{businessLicenseNum},party_Id=#{partyId} where id =#{id}")
    int update(PartyCheck partyCheck)throws Exception;

    @Select("select * from party_check where party_Name=#{partyName}")
    PartyCheck queryByPartyName(String partyName) throws Exception;

    @Select(" select * from party_check where id=#{id}")
    PartyCheck queryById(String id)throws Exception;

    @SelectProvider(
            type = PartyCheckMappSql.class,
            method = "queryPartyCheckList"
    )
    List<PartyCheck> queryPartyCheckList(PartyCheck partyCheck)throws Exception;

    @Delete(" delete from party_check where party_id=#{partyId}")
    int deleteByPartyId(String partyId)throws Exception;

}
